package com.tvein.sanguo.prompt.controller
{
	//flash
	//pureMVC
	import org.puremvc.as3.multicore.interfaces.ICommand;
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
	//custom
	import com.tvein.sanguo.prompt.common.GameConstants;
	import com.tvein.sanguo.prompt.model.SystemProxy;
	import com.tvein.sanguo.prompt.model.MessageProxy;
	import com.tvein.sanguo.prompt.view.PromptMediator;
//
	public class PromptInit extends SimpleFabricationCommand implements ICommand
	{
		private var promptMediator:PromptMediator;
		private var systemData:SystemProxy;
		private var messageData:MessageProxy;
		
		override public function execute(notification:INotification) : void
		{
			promptMediator = facade.retrieveMediator(PromptMediator.NAME) as PromptMediator;
			systemData = facade.retrieveProxy(SystemProxy.NAME) as SystemProxy;
			messageData = facade.retrieveProxy(MessageProxy.NAME) as MessageProxy;
			
			switch(notification.getBody()[0])
			{
				case "srcServer":
					systemData.srcServer = notification.getBody()[1];
					break;
				case "effectVol":
					systemData.effectVol = notification.getBody()[1];
					break;
				case "show":
					promptMediator.prompt.visible = notification.getBody()[1];
					break;
				case "advice":
					routeNotification(GameConstants.MODULE_INVOKE, ["-tool", ["advice", messageData.message]], null, GameConstants.MODULE_ACTION + "/*");
					break;
			}
		}
	}
}